﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Imagiality.MeshProcessing
{
    public abstract class NodeSceneObject : SceneObject
    {
        private Transform transform;
        protected SceneObject parent;
        protected uint ID;

        public NodeSceneObject(SceneObject parent)
        {
            this.parent = parent;
        }

        public SceneObject Parent
        {
            get 
            {
                return parent;
            }
        }

        public uint GetID()
        {
            return ID;
        }

        public Transform Transform
        {
            get
            {
                return transform;
            }
            set
            {
                transform = value;
            }
        }

        public void BindID(IDGenerator generator)
        {
            ID = generator.Next(this);

            IList<NodeSceneObject> children = GetChilds();

            foreach (NodeSceneObject child in children)
                child.BindID(generator);
        }

        public abstract IList<NodeSceneObject> GetChilds();
      
    }
}
